# -*- coding:utf-8 -*-
# @FileName  :dhcc_per_7_checkinfolog.py
# @Time      :2020/12/23 13:52
# @Author    :Zhoujirong
# @Desc      : 个人审批记录
import datetime
from common.log import Log
from biz.cases.base_case import BaseCase
from biz.flow.per_checkinfolog import PerCheckInfoRequest

class TestPerCheckInfoLog(BaseCase):
    data_file_name = 'per_report.yaml'
    @classmethod
    def setUpClass(cls) -> None:
        cls.cookie = BaseCase().get_token()

    def get_page(self):
        '''检索'''
        curPage = self.file_data.get('curPage')
        maxSize = self.file_data.get('maxSize')
        search_EQ_clientName = self.file_data.get('name')
        search_EQ_certType = self.file_data.get('certType')
        search_EQ_certNo = self.file_data.get('certNo')
        search_EQ_qryReason = self.file_data.get('qryReason')
        search_EQ_status = self.file_data.get('search_EQ_status')
        search_EQ_queryFormat = '00'
        search_EQ_operator = self.file_data.get('search_EQ_operator')
        search_EQ_operOrg = self.file_data.get('search_EQ_operOrg')
        tmp = datetime.date.today()
        search_GTE_LTE_operTime_DATE_RANGE = '%s - %s'%(tmp,tmp)
        ret = PerCheckInfoRequest.get_page(curPage,
        maxSize,
        search_EQ_clientName,
        search_EQ_certType,
        search_EQ_certNo,
        search_EQ_qryReason,
        search_EQ_status,
        search_EQ_queryFormat,
        search_EQ_operator,
        search_EQ_operOrg,
        search_GTE_LTE_operTime_DATE_RANGE,self.cookie)
        Log.info(ret)
        self.assertIsNotNone(ret.list)
        return ret.list[0]

    def test_get_page_all(self):
        '''全条件检索'''
        curPage = self.file_data.get('curPage')
        maxSize = self.file_data.get('maxSize')
        search_EQ_clientName = self.file_data.get('name')
        search_EQ_certType = self.file_data.get('certType')
        search_EQ_certNo = self.file_data.get('certNo')
        search_EQ_qryReason = self.file_data.get('qryReason')
        search_EQ_status = self.file_data.get('search_EQ_status')
        search_EQ_queryFormat = '00'
        search_EQ_operator = self.file_data.get('search_EQ_operator')
        search_EQ_operOrg = self.file_data.get('search_EQ_operOrg')
        tmp = datetime.date.today()
        search_GTE_LTE_operTime_DATE_RANGE = '%s - %s'%(tmp,tmp)
        ret = PerCheckInfoRequest.get_page(curPage,
        maxSize,
        search_EQ_clientName,
        search_EQ_certType,
        search_EQ_certNo,
        search_EQ_qryReason,
        search_EQ_status,
        search_EQ_queryFormat,
        search_EQ_operator,
        search_EQ_operOrg,
        search_GTE_LTE_operTime_DATE_RANGE,self.cookie)
        Log.info(ret)
        self.assertIsNotNone(ret.list)

    def test_detail(self):
        '''跳转详情页'''
        id = self.get_page().id
        ret = PerCheckInfoRequest.detail(id,self.cookie)
        Log.info(ret)
        self.assertIn('个人审批记录',ret)

    def test_findbyid(self):
        '''详情'''
        name = self.file_data.get('name')
        id =  self.get_page().id
        ret = PerCheckInfoRequest.findbyid(id,self.cookie)
        Log.info(ret)
        self.assertEqual(name,ret.clientName)

    def test_getpagerecord(self):
        '''详情中审批记录--步骤'''
        curPage = self.file_data.get('curPage')
        maxSize = self.file_data.get('maxSize')
        id = self.get_page().id
        ret = PerCheckInfoRequest.getpagerecord(curPage,maxSize,id,self.cookie)
        Log.info(ret)
        self.assertEqual('13',ret.list[0].status)
        self.assertEqual('12',ret.list[1].status)






if __name__ == "__main__":
    pass